package com.example.mapper;

import com.example.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @Select("select * from category where create_user = #{createUser}")
    List<Category> getAllCategory(Integer createUser);

    @Insert("insert into category(category_name,category_alias,create_user) values(#{categoryName},#{categoryAlias},#{createUser})")
    void addNewCategory(Category category);

    @Select("select * from category where id = #{id}")
    Category getCategoryById(int id);

    @Update("update category set category_name = #{categoryName},category_alias = #{categoryAlias} where id = #{id}")
    void updateCategory(Category category);

    @Delete("delete from category where id = #{id}")
    void deleteCategoryById(int id);
}
